home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / global-one-water.swf / scripts / __Packages / SO.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.9 KB  |  77 lines

  1. class SO
  2. {
  3.    static var root;
  4.    static var onExternalInit;
  5.    static var externalSOPath;
  6.    static var lso;
  7.    static var mcl;
  8.    static var eso;
  9.    static var externalSODomain = "http://projects.kempt.co.uk/";
  10.    static var externalSOPathEnd = "/swf/so.swf";
  11.    function SO()
  12.    {
  13.    }
  14.    static function init(r, name, oei)
  15.    {
  16.       SO.root = r;
  17.       SO.onExternalInit = oei;
  18.       System.security.allowDomain(SO.externalSODomain);
  19.       SO.externalSOPath = SO.externalSODomain + name + SO.externalSOPathEnd;
  20.       SO.lso = SharedObject.getLocal(name,"/");
  21.       SO.mcl = new MovieClipLoader();
  22.       SO.mcl.addListener(SO);
  23.       SO.mcl.loadClip(SO.externalSOPath,SO.root.createEmptyMovieClip("eso_mc",SO.root.getNextHighestDepth()));
  24.    }
  25.    static function onLoadComplete(targ)
  26.    {
  27.       trace("external swf loaded!");
  28.       SO.eso = targ.getSO();
  29.       if(SO.eso.data._setData)
  30.       {
  31.          for(var _loc1_ in SO.eso.data)
  32.          {
  33.             SO.lso.data[_loc1_] = SO.eso.data[_loc1_];
  34.          }
  35.          SO.lso.flush();
  36.       }
  37.       else if(SO.lso.data._setData)
  38.       {
  39.          for(_loc1_ in SO.lso.data)
  40.          {
  41.             SO.eso.data[_loc1_] = SO.lso.data[_loc1_];
  42.          }
  43.          SO.eso.flush();
  44.       }
  45.       SO.onExternalInit();
  46.    }
  47.    static function getVar(n)
  48.    {
  49.       return SO.lso.data[n];
  50.    }
  51.    static function setVar(n, v)
  52.    {
  53.       if(SO.eso)
  54.       {
  55.          SO.eso.data._setData = true;
  56.          SO.eso.data[n] = v;
  57.          SO.eso.flush();
  58.       }
  59.       SO.lso.data._setData = true;
  60.       SO.lso.data[n] = v;
  61.       SO.lso.flush();
  62.    }
  63.    static function clearSO()
  64.    {
  65.       for(var _loc1_ in SO.lso.data)
  66.       {
  67.          delete SO.lso.data[_loc1_];
  68.       }
  69.       SO.lso.flush();
  70.       for(_loc1_ in SO.eso.data)
  71.       {
  72.          delete SO.eso.data[_loc1_];
  73.       }
  74.       SO.lso.flush();
  75.    }
  76. }
  77.